#ifndef _DEMOMSG_H_
#define _DEMOMSG_H_

#define NORMAL_SHORT_STR_LEN 32

//MAXID_USER_SERVER
enum
{
	MSG_USER_LOGIN_REQ = 0x1,
	MSG_USER_LOGIN_ACK,
	MSG_USER_MOVE_REQ,
	MSG_USER_MOVE_ACK,
	MSG_USER_ACTION_REQ,
	MSG_USER_ACTION_ACK,
	MSG_OTHERUSER_MOVE,
	MSG_OTHERUSER_ACTION,
	MSG_USER_SCENE_REQ,
	MSG_USER_SCENE_ACK,
};

//MAXID_SERVER_SERVER
enum
{
	MSG_USER_CHG_MAP = 0x1,
	MSG_USER_CHG_MAP_RET,
	MSG_USER_LEAVE_MAP,
	MSG_USER_LEAVE_MAP_RET,
	MSG_BROADCAST_TOUSER,
	MSG_SERVER_REG,
};

//server type
enum
{
	SERVER_TYPE_MAP = 0x01,
	SERVER_TYPE_SHOP,
	SERVER_TYPE_GUILD,
	SERVER_TYPE_MARRY,
	SERVER_TYPE_FRIEND,
	SERVER_TYPE_CHAT,
};

typedef struct login_req_t
{
	char username[NORMAL_SHORT_STR_LEN];
	char password[NORMAL_SHORT_STR_LEN];
} login_req_t;

typedef enum USER_ACTION
{
	ACT_MOV_UP = 1,
	ACT_MOV_LEFT,
	ACT_MOV_DOWN,
	ACT_MOV_RIGHT,
	ACT_ATTACK_UP,
	ACT_ATTACK_LEFT,
	ACT_ATTACK_DOWN,
	ACT_ATTACK_RIGHT,	
} USER_ACTION;

typedef struct act_t
{
	USER_ACTION act;
	NDINT32 index;
} act_t;

typedef struct user_info_t
{
	NDINT8 rolename[NORMAL_SHORT_STR_LEN];
	NDUINT32 id;
	NDINT32 level;
	NDINT32 hp;
	NDINT32 mp;
	NDINT32 attack;
	NDINT32 recover;
	NDINT32 pos_x;
	NDINT32 pos_y;	
	act_t act;
	NDINT32 money;
	NDINT32 experience;
	NDINT32 addedattack;
	NDINT32 addedrecover;
	NDINT32 rollcall;
	struct list_head quad_lst;
	struct list_head *quad_head;  // not used yet
} user_info_t;

typedef struct login_ack_t
{
	NDINT32 result;
	user_info_t user_info;
} login_ack_t;

typedef struct moveto_newmap_t
{
	NDINT32 id;
	user_info_t user_info;	
} moveto_newmap_t;

typedef struct user_move_req_t
{
	NDINT32 action;
	NDINT32 x;
	NDINT32 y;
} user_move_req_t;

typedef struct user_move_ack_t
{
	NDINT32 result;
	NDINT32 action;
	NDINT32 x;
	NDINT32 y;
} user_move_ack_t;

typedef struct user_action_t
{
	NDINT8 rolename[NORMAL_SHORT_STR_LEN];
	act_t action;
	NDUINT32 param;
	NDINT32 x;
	NDINT32 y;
} user_action_t;

typedef struct user_scene_t
{
	NDINT32 num;
	user_action_t player[0];
} user_scene_t;

typedef struct broadcast_info_t
{
	NDINT32 real_maxid;
	NDINT32 real_minid;
	NDINT32 usernum;
	NDINT32 userid[0];
} broadcast_info_t;

#endif
